<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <style>
        .checkbox-inline input[type=checkbox], .radio-inline input[type=radio] {
            margin-top: 4px;
        }
    </style>
    <style>
        #gopage {
            color: blue;
            cursor: pointer;
        }

        #firstpage {
            cursor: pointer;
        }

        #pagesize {
            height: 23px;
        }
    </style>
</head>

<body style="color:#333;padding:3px;">
<!-- 标题 -->
<div class="page-heade">
    <h2 class="title_color text-center">月拜访目标管理</h2>
</div>
<!-- 标题 -->
<div>

    <form action="#" method="post" id="form_check" accept-charset="utf-8" class="form-inline">

        <table class="row-margin-top tab-content table-bordered table text-left" border="1">
            <tr>
                <td colspan="6">
                    <button class="btn btn-primary btn-sm newaim" type="button">新增目标</button>
                    <span class="lr_5"></span>
                    <button class="btn btn-primary btn-sm">导出拜访目标</button>
                    <span class="lr_5"></span>
                    <a class="btn btn-primary btn-sm J_menuItem" href='{:url("lendbfaim")}'>导入拜访目标</a>
                </td>
            </tr>
            <tr>
                <td style="min-width: 140px" class="text-right"><label for="" class="form-label">姓名：</label></td>
                <td><input type="text" class="form-control" value='{$bfr_name}' name="bfr_name"></td>
                <td style="min-width: 140px" class="text-right"><label for="" class="form-label">岗位：</label></td>
                <td><input type="text" class="form-control" name="gw_name" value='{$gw_name}'></td>
                <td style="min-width: 140px" class="text-right"><label for="" class="form-label">部门：</label></td>
                <td>
                    <select name="ssbm" id="" class="form-control select">
                        <option value="0">请选择</option>
                        {volist name="bm" id="row"}
                        <option value="{$row.id}" {if $ssbm==$row.id}selected{/if}>{$row.de_name}</option>
                        {/volist}
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="6" class="text-center">
                    <input type="submit" value="查询" class='btn btn-sm btn-info' id="check"/>
                    <input type="button" value="清空查询条件" class='btn btn-sm btn-info' id="clear_check"/>
                </td>
            </tr>
        </table>
    </form>
    <table class="table row-margin-top table-bordered table-hover text-center bud_hei">
        <tr class="info">
            <th class="text-center">序号</th>
            <th class="text-center">姓名</th>
            <th class="text-center">岗位</th>
            <th class="text-center">所属部门</th>
            <th class="text-center">经销商月拜访数</th>
            <th class="text-center">网点月拜访数</th>
            <th class="text-center">合计目标数</th>
            <th class="text-center">操作</th>
        </tr>
        {volist name="data" id="row" key="k"}
        <tr class="text-center">
            <td>{$k+((request()->get('page')?request()->get('page'):1)-1)*10}</td>
            <td>{$row.bfr_name}</td>
            <td>{$row.gw_name}</td>
            <td>{$row.ssbm_name}</td>
            <td>{$row.jxsybfmbs}</td>
            <td>{$row.wdybfmbs}</td>
            <td>{$row.wdybfmbs+$row.jxsybfmbs}</td>
            <td><a onclick="xiugai('{$row.id}')">修改</a>
                <a onclick="shanchu('{$row.id}')">删除</a></td>
        </tr>
        {/volist}
    </table>


</div>
<!-- 全局js -->
<script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
<script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
<!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
<script src="__STATIC__/layout/js/common.js"></script>
<script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script>
    // function details(id){
    // 	var index = layer.open({
    //                   type:2,
    //                   title:'查看详情',
    //                   area:['80%','80%'],
    //                   maxmin:true,
    //                   content:'{:url("details")}?gid='+id
    //               })
    //               layer.full(index)
    // }
    function xiugai(id) {
        layer.open({
            type: 2,
            title: '新增月拜访目标',
            area: ['800px', '600px'],
            fixed: false, //不固定
            maxmin: true,
            content: '{:url("updatembfaim")}?id='+id
        });
        return false
    }

    function shanchu(id) {
        swal({
                title: "提示",
                text: "您真的要删除这个供应商么？",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#FF3333",
                confirmButtonText: "是的我要删除",
                cancelButtonText: "取消",
                closeOnConfirm: true
            },
            function (isConfirm) {
                if (isConfirm) {
                    $.post("{:url('drop')}", {id: id}, function (re) {
                        if (re.success) {
                            swal({
                                title: "完成",
                                text: "供应商已删除",
                                type: "success"
                            }, function () {
                                location.reload();
                            });
                        } else {
                            swal({
                                title: "错误",
                                text: "系统繁忙请稍后再试",
                                type: "warning"
                            });
                        }
                    },'json')
                }
            })
    }

    $(".newaim").click(function () {
        layer.open({
            type: 2,
            title: '新增月拜访目标',
            area: ['800px', '600px'],
            fixed: false, //不固定
            maxmin: true,
            content: '{:url("addmbfaim")}'
        });
        return false
    })

    //           function wordlimit(cname,num){
    // 　          for(var i=0;i<cname.length;i++){
    // 　　　　　　var nowLength=cname[i].innerHTML.length;
    //                 if(nowLength>num){
    //                   return cname[i].innerHTML=cname[i].innerHTML.substr(0,num)+'...'
    //                   }
    //                 }
    //               }　

    //翻页
    /*   $("#pagesize").change(function(){
           $("#page-go").val(1);
           $("#list-go").val($(this).val());
           document.getElementById("form_check").submit();
       })
       $("#gopage").click(function(){
            $("#page-go").val($("#page").val());
             document.getElementById("form_check").submit();
       })
       $("#page").keyup(function(){

           if(isNaN(parseInt($(this).val()))){
               $(this).val(1);
           }else{
               $(this).val(parseInt($(this).val()));
           }

       })
       $("#fistpage").click(function(){
             $("#page-go").val(1);
             document.getElementById("form_check").submit();
       })
       $("#check").click(function(){
             $("#page-go").val(1);
             document.getElementById("form_check").submit();
       })
       */
    $("#clear_check").click(function(){
        $(this).closest('form').find('input').val('')
        $(this).closest('form').find('select').val('')
        $(this).closest('form').submit();
    })
</script>
</body>

</html>
